<include file="header" />
<link rel="stylesheet" href="/assets/public/mobiscroll/css/mobiscroll.custom-3.0.0-beta2.min.css">
<body>
<div class="wraper">
    <div class="top">
        <a href="{BEESCRM::U('base/ips/index',array('ips_id'=>$ips_id))}" class="iconfont icon-zuo pull-left"></a>
        <span class="pull-left">申请退款</span>
    </div>
    <div class="margin-top">
        <p class="form-box">
            <select id="community">
                <option value="0">请选择所在生活区</option>
                <volist name="communityList" id="vo">
                    <option value="{BEESCRM:$vo.community_id}" <if condition="$vo['community_id'] eq $community_id" >selected="selected"</if>>{BEESCRM:$vo.community_name}</option>
                </volist>
            </select>
            <span class="triangle"></span>
        </p>
        <p class="form-box">
            <select id="building">
                <option value="0">请选择楼幢</option>
	            <if condition="$building">
		            <volist name="building" id="vo">
			            <option value="{BEESCRM:$vo.building_id}"<if condition="$building_id eq $vo['building_id']">selected="selected"</if>>{BEESCRM:$vo.building_name}</option>
		            </volist>
	            </if>
            </select>
            <span class="triangle"></span>
        </p>
	    <p class="form-box">
            <select id="floor">
                <option value="0">请选择楼层</option>
	            <if condition="$floor">
		            <volist name="floor" id="vo">
			            <option value="{BEESCRM:$vo.floor_id}"<if condition="$floor_id eq $vo['floor_id']">selected="selected"</if>>{BEESCRM:$vo.floor_name}</option>
		            </volist>
	            </if>
            </select>
            <span class="triangle"></span>
        </p>
        <p class="form-box">
	        <select id="room">
		        <option value="0">请选择<if condition="$ecs_id eq 9">商户<else/>寝室</if></option>
		        <if condition="$room">
			        <volist name="room" id="vo">
				        <option value="{BEESCRM:$vo.room_id}"<if condition="$room_id eq $vo['room_id']">selected="selected"</if>>{BEESCRM:$vo.room_name}</option>
			        </volist>
		        </if>
	        </select>
	        <span class="triangle"></span>
        </p>
    </div>

    <div class="margin-top">
        <div class="form-box">
            <input type="text" name="user-name" id="user-name" value="{BEESCRM:$username}" disabled>
        </div>
        <div class="form-box">
            <input type="text" name="user-number" id="user-number" value="{BEESCRM:$usernumber}" disabled>
        </div>
        <div class="form-box">
            <input type="text" name="user-phone" id="user-phone" value="{BEESCRM:$userphone}" placeholder="请输入您的手机号">
        </div>
        <div class="form-box" >
            <input type="text"  name="leave-time" id="leave-time" value="" placeholder="请选择离校时间">
            <span class="triangle"></span>
        </div>
    </div>

    <div class="btn-box" style="overflow:auto">
            <a href="javascript:void(0);" class="btn save" style="width: 49%;float:left;">立即申请</a>
            <a href="{BEESCRM::U('base/ips/applyStatus',array('ips_id'=>$ips_id,'refund_id'=>$refundInfo['refund_id'],'type'=>$type))}" class="btn" style="width: 49%;float:right;">申请进度</a>
    </div>
</div>
<input type="hidden" value="{BEESCRM:$ips_id}" id="ecs">
<include file="commonJS" />
<script src="/assets/base/common/ajaxgetroominfo.js"></script>
<script src="/assets/public/mobiscroll/mobiscroll.custom-3.0.0-beta2.min.js"></script>
<script>
    // 联动
    ajaxgetroominfo(true,true,true);
</script>
<script>
    $('.icon-caidan-copy').click(function(e){
        $('.sub-menu').toggleClass('show');
        e.stopPropagation();
    })
    $(document).click(function(){
        $('.sub-menu').removeClass('show');
    })
</script>
<script>
    /*提交申请*/
    $(document).on('click','.save',function(){
        var room = $('#room').val();
        var ips_id = $('#ecs').val();
        if(!room){
            $.alert('error','请选择寝室');
            return false;
        }
        var leave_time= $('#leave-time').val();
        var phone = $('#user-phone').val();
        var username = $('#user-name').val();
        var info = {};
        info.room_id = room;
        info.leave_time = leave_time;
        info.phone=phone;
        info.username = username;

        $.ajax({
            'url': "/base/ips/applyRefund/ips_id/"+ips_id,
            'data': info,
            'dataType':'json',
            'type': 'POST',
            'async': false,
            success: function(data) {
                if (data.status == 'S') {
                   window.location.href=data.uri;
                }else{
                    $.layeralert(data.message);
                    return false;
                }
            }
        });
    });

    $(document).on('click','#tip-btn',function(){
	    $('.pop-box').hide();
    })

	function dump(){
		window.location.href='/base/ips/index/ips_id/8';
	}

	/*日历插件*/
    $(function () {
        $('#leave-time').mobiscroll().date({
            theme: 'android-holo-light',//皮肤样式
            lang: 'zh',//中文
            display: 'bottom',//位于底部
            dateFormat: 'yyyy-mm-dd'//格式
        });
    });
</script>
</body>
</html>